﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.ComponentModel;

namespace OrderManager.Orders
{
    class Order : INotifyPropertyChanged
    {
        private string sellerComment;
        private OrderFlag flag;
        private string address;

        /// <summary>
        /// 获取或者设置一个值，以指示相应的店铺信息，包含类型与名称
        /// </summary>
        public string ShopInfo { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示订单编号
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示在购物平台的用户名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示相应的昵称
        /// </summary>
        public string NickName { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示用户的真实名称
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示订单的金额
        /// </summary>
        public string Money { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示收获地址
        /// </summary>
        public string Address { get { return this.address; } set { this.address = value; this.OnPropertyChanged("Address"); } }

        /// <summary>
        /// 获取或者设置一个值，以指示手机号码，如果手机号码为空，则为座机号码
        /// </summary>
        public string Phone { get; set; }

        public string BuyerComment { get; set; }

        public string SellerComment { get { return this.sellerComment; } set { this.sellerComment = value; this.OnPropertyChanged("SellerComment"); } }

        public OrderFlag Flag { get { return this.flag; } set { this.flag = value; this.OnPropertyChanged("Flag"); } }

        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 获取或者设置一个值，以指示商品的名称，颜色，尺码等信息
        /// </summary>
        public OrderItem FirstItem { get; set; }

        /// <summary>
        /// 获取一个值，以指示其它的购买物品
        /// </summary>
        public List<OrderItem> AllItems { get; private set; }

        /// <summary>
        /// 获取或者设置，产生此订单管理类
        /// </summary>
        public OrderManagerBase OrderManager { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public Order()
        {
            this.AllItems = new List<OrderItem>();
        }
    }
}
